package com.hightrast.service.api.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 订单状态
 *
 */
public enum OrderStatusEnum implements IEnum<Integer> {

    Goods_Received(1, "Goods Received"),//已到货

    Return_Goods(2, "Return Goods"), //已退款

    In_Transit(3, "In Transit") //进行中

    ;

    /**
     * 值
     */
    @EnumValue
    private final Integer value;

    /**
     * 描述
     */
    private final String desc;


    OrderStatusEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @JsonCreator
    public static OrderStatusEnum getItem(int code) {
        for (OrderStatusEnum item : values()) {
            if (item.getValue() == code) {
                return item;
            }
        }
        return null;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @JsonValue
    public String getDesc() {
        return desc;
    }
}
